import storage from 'good-storage'

// 存小区Id
const VILLAGE_ID = '__villageid__'

export function saveVillageId (villageid) {
  storage.set(VILLAGE_ID, villageid)
}

export function loadVillageId () {
  return storage.get(VILLAGE_ID)
}

// 存小区名称
const TITLE = '__title__'

export function saveTitle (title) {
  storage.set(TITLE, title)
}

export function loadTitle () {
  return storage.get(TITLE)
}

// 存城市名称
const CITY = '__city__'

export function saveCity (city) {
  storage.set(CITY, city)
}

export function loadCity () {
  return storage.get(CITY)
}

// 存城市Id
const CITY_ID = '__cityid__'

export function saveCityId (cityid) {
  storage.set(CITY_ID, cityid)
}

export function loadCityId () {
  return storage.get(CITY_ID)
}

export function clearCity () {
  storage.remove(CITY)
  return ''
}

// 存openid
const OPEN_ID = '__openid__'

export function saveOpenId (openid) {
  storage.set(OPEN_ID, openid)
}

export function loadOpenId () {
  if (storage.get(OPEN_ID) === undefined) {
    return false
  } else {
    return storage.get(OPEN_ID)
  }
}

// 存用户名字和手机号码
const PHONE_NAME = '__phonename__'

export function savePhoneName (phonename) {
  storage.set(PHONE_NAME, phonename)
}

export function loadPhoneName () {
  if (storage.get(PHONE_NAME) === undefined) {
    return false
  } else {
    return storage.get(PHONE_NAME)
  }
}

// 存用户ID
const USER_ID = '__userid__'

export function saveUserId (userid) {
  storage.set(USER_ID, userid)
}

export function loadUserId () {
  return storage.get(USER_ID)
}

// 存查验点击的类别id
const CLICK_DATA = '__clickdata__'

export function saveClickData (clickdata) {
  storage.session.set(CLICK_DATA, clickdata)
}

export function loadClickData () {
  return storage.session.get(CLICK_DATA)
}

// 缓存电梯编号
const LIFT_NUM = '__liftnum__'

export function saveLiftNum (liftnum) {
  storage.session.set(LIFT_NUM, liftnum)
}

export function loadLiftNum () {
  return storage.session.get(LIFT_NUM)
}

export function clearLiftNum () {
  storage.session.remove(LIFT_NUM)
}

// 投票统计缓存小区苑幢单元
const AREAS_NAME = '__areasname__'

export function saveAreasName (areasname) {
  storage.session.set(AREAS_NAME, areasname)
}

export function loadAreasName () {
  return storage.session.get(AREAS_NAME)
}

// 缓存房屋租售市code
const CITY_CODE = '__citycode__'

export function saveCityCode (citycode) {
  storage.session.set(CITY_CODE, citycode)
}

export function loadCityCode () {
  return storage.session.get(CITY_CODE)
}

// 存时间戳
const TIME_STAMP = '__timestamp__'

export function saveTIME (timestamp) {
  storage.set(TIME_STAMP, timestamp)
}

export function loadTIME () {
  return storage.get(TIME_STAMP)
}

// 存放判断用户登录是否过期标识
const USER_OVER = '__userover__'

export function saveOVER (userover) {
  storage.set(USER_OVER, userover)
}

export function loadOVER () {
  return storage.get(USER_OVER)
}

// 存小区Id（仅限于发单平台）
const HOME_ID = '__homeid__'

export function saveHomeId (homeid) {
  storage.set(HOME_ID, homeid)
}

export function loadHomeId () {
  return storage.get(HOME_ID)
}

// 存小区名称（仅限于发单平台）
const HOMETITLE = '__hometitle__'

export function saveHomeTitle (hometitle) {
  storage.set(HOMETITLE, hometitle)
}

export function loadHomeTitle () {
  return storage.get(HOMETITLE)
}

// 存城市名称（仅限于发单平台）
const ORDERCITY = '__ordercity__'

export function saveOrderCity (ordercity) {
  storage.set(ORDERCITY, ordercity)
}

export function loadOrderCity () {
  return storage.get(ORDERCITY)
}

// 存城市Id（仅限于发单平台）
const ORDERCITY_ID = '__ordercityid__'

export function saveOrderCityId (ordercityid) {
  storage.set(ORDERCITY_ID, ordercityid)
}

export function loadOrderCityId () {
  return storage.get(ORDERCITY_ID)
}

// 存放发单平台的查验类型选择的结果名称
const CHECK_TYPE = '__checktype__'

export function saveCheckType (checktype) {
  storage.set(CHECK_TYPE, checktype)
}
export function loadCheckType () {
  return storage.get(CHECK_TYPE)
}
// 存放发单平台的查验类型选择的结果名称对应的id
const CHECK_TYPEID = '__checktypeid__'

export function saveCheckTypeId (checktypeid) {
  storage.set(CHECK_TYPE, checktypeid)
}
export function loadCheckTypeId () {
  return storage.get(CHECK_TYPEID)
}

// 存放发单平台的查验标题
const CHECK_TITLE = '__checktitle__'

export function saveCheckTitle (checktitle) {
  storage.set(CHECK_TITLE, checktitle)
}
export function loadCheckTitle () {
  return storage.get(CHECK_TITLE)
}

// 存用户是否点击了同意协议书
const REAL_CUTH = '__realcuth__'

export function saveRealCuth(realcuth) {
  storage.set(REAL_CUTH, realcuth)
}

export function loadRealCuth() {
  return storage.get(REAL_CUTH)
}

// 缓存查验里的房屋信息
const CY_HOME = '__cyhome__'
export function saveCyHome (cyhome) {
  storage.set(CY_HOME, cyhome)
}
export function loadCyHome() {
  return storage.get(CY_HOME)
}
// 房屋信息id
const CY_HOMEID = '__cyhomeid__'
export function saveCyHomeId (cyhomeid) {
  storage.set(CY_HOMEID, cyhomeid)
}
export function loadCyHomeId() {
  return storage.get(CY_HOMEID)
}

// 缓存查验里的房号name
const ROOM_NAME = '__roomname__'
export function saveRoomName (roomname) {
  storage.set(ROOM_NAME, roomname)
}
export function loadRoomName() {
  return storage.get(ROOM_NAME)
}

// 缓存查验里的房号id
const ROOM_ID = '__roomid__'
export function saveRoomId (roomid) {
  storage.set(ROOM_ID, roomid)
}
export function loadRoomId() {
  return storage.get(ROOM_ID)
}
